import Vue from 'vue'
import VueRouter from 'vue-router'
// import Login from '@/views/Login'
// import Layout from '@/views/Layout'
// import Home from '@/views/Second/Home'
// import User from '@/views/Second/User'
import Demo from '@/demo/vmodel.vue'
// import Search from '@/views/Search'
// import SearchResult from '@/views/Search/SearchResult.vue'
// import UserEditor from '@/views/Second/User/UserEditor'
// import Chat from '@/views/Chat'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    component: () => import('@/views/Login')
  },
  {
    path: '/layout',
    name: 'layout',
    component: () => import('@/views/Layout'),
    redirect: '/layout/home', // 重定向
    children: [
      {
        path: 'home',
        name: 'home',
        component: () => import('@/views/Second/Home'),
        meta: { isScroll: true, top: 0 }
      },
      {
        path: 'user',
        name: 'user',
        component: () => import('@/views/Second/User')
      }
    ]
  },
  {
    path: '/demo',
    component: () => import('@/demo/vmodel.vue')
  },
  {
    path: '/search',
    component: Demo
  },
  {
    path: '/search/:keywords',
    component: () => import('@/views/Search/SearchResult.vue')
  },
  {
    path: '/article_detail',
    component: () => import('@/views/ArticleDetail')
  },
  {
    path: '/user_edit',
    component: () => import('@/views/Second/User/UserEditor')
  },
  {
    path: '/chat',
    component: () => import('@/views/Chat')
  }
]

const router = new VueRouter({
  routes
})

export default router
